package me.send.data.service.provider;

import java.util.Map;

import me.send.business.base.SendVariable;
import me.send.data.service.pojo.Orders;

public class OrdersProvider {


	public String list_page(Map<String, Object> parameter) {
		// 获取 对象 查询对象 2015年6月23日17:34:01
		Orders orders = (Orders) parameter.get(SendVariable.DATA);
		// 判断下面的字段 是否是null
		String sql = "select * from orders where 1=1 ";
		if (orders != null) {
			if (orders.getDescption() != null
					&& !orders.getDescption().equals("")) {
				sql += " and descption like CONCAT('%',#{DATA.descption},'%' ) ";
			}
			if (orders.getOrdertypeid() > 0) {
				sql += " and ordertypeid = #{DATA.ordertypeid} ";
			}
			if (orders.getStatus() > 0) {
				sql += " and status = #{DATA.status}";
			}
		}
		sql += " limit #{PAGE.start},#{PAGE.rows} ";
		return sql;
	}
	
	public String count(Map<String, Object> parameter){
		// 获取 对象 查询对象 2015年6月23日17:34:01
		Orders orders = (Orders) parameter.get(SendVariable.DATA);
		// 判断下面的字段 是否是null
		String sql = "select count(1) as total from orders where 1=1 ";
		if (orders != null) {
			if (orders.getDescption() != null
					&& !orders.getDescption().equals("")) {
				sql += " and descption like CONCAT('%',#{DATA.descption},'%' ) ";
			}
			if (orders.getOrdertypeid() > 0) {
				sql += " and ordertypeid = #{DATA.ordertypeid} ";
			}
			if (orders.getStatus() > 0) {
				sql += " and status = #{DATA.status}";
			}
		}
		return sql;
	}

}
